package com.cluster.platform.controller;

import com.cluster.platform.common.api.CommonResult;
import com.cluster.platform.model.CmsChannelChild;
import com.cluster.platform.service.CmsChannelChildService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: CmsChannelChild
 * @Author: xiezhongping
 * @Date: 2021/2/2 16:55
 * @修改日志
 */
@RestController
@Api(tags = "栏目子菜单接口", value = "CmsChannelChildController")
@RequestMapping("/cmsChannelChild")
public class CmsChannelChildController {

    @Autowired
    CmsChannelChildService cmsChannelChildService;

    @ApiOperation("查询栏目子菜单")
    @GetMapping("/searchColumnsChild")
    public CommonResult<Object> searchColumnsChild(@RequestParam("parentId")String parentId,@RequestParam("pageNum")Integer pageNum,@RequestParam("pageSize")Integer pageSize){
        return cmsChannelChildService.searchColumnsChild(parentId,pageNum,pageSize);
    }

    @ApiOperation("新增栏目子菜单")
    @PostMapping("/addCmsChannelChild")
    public CommonResult<Object> addCmsChannelChild(@RequestBody CmsChannelChild cmsChannelChild) {
        return cmsChannelChildService.addCmsChannelChild(cmsChannelChild);
    }

    @ApiOperation("删除栏目子菜单-物理")
    @DeleteMapping("/deleteCmsChannelChild")
    public CommonResult<Object> deleteCmsChannelChild(@RequestParam("id") String id){
        return cmsChannelChildService.deleteCmsChannelChild(id);
    }

    @ApiOperation("更新栏目子菜单")
    @PutMapping("/updateCmsChannelChild")
    public CommonResult<Object> updateCmsChannelChild(@RequestBody CmsChannelChild cmsChannelChild) {
        return cmsChannelChildService.updateCmsChannelChild(cmsChannelChild);
    }

}
